﻿#include <iostream>
#include <thread>
#include <random>
#include <string>
#include <mutex>
using namespace std;
vector<int> VT_INT = vector<int>();
const static int N = 100;
const static int Thread_N = 5;
mutex m;
void _Init() {
	random_device rd;
	uniform_int_distribution<int> dist(100, 999);
	for (int i = 0; i < N; ++i) {
		VT_INT.push_back(dist(rd));
	}
}
void _Worker() {
	while (!VT_INT.empty()) {
		int n = VT_INT.back();
		VT_INT.pop_back();
		cout << n << endl;
		string s;
		s = to_string(n);
		if (*(s.end() - 1) == '6') {
			m.lock();
			VT_INT.clear();
			m.unlock();
		}
	}
}
int main()
{
	//
	开启
		5
		个线程取数据
		_Init();
	thread threads[Thread_N];
	for (int i = 0; i < Thread_N; ++i) {
		threads[i] = thread(_Worker);
	}
	for (int i = 0; i < Thread_N; ++i) {
		threads[i].join();
		6
			46
			47
	}
}